package my;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

public class ImgUploadClient {

	@SuppressWarnings("resource")
	public static void main(String[] args) throws UnknownHostException, IOException {
		Socket socket = new Socket("127.0.0.1",8890);
		BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\OSI-TCP.jpg"));
		BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream());
		byte[] bytes = new byte[1024];
		int len = 0;
		while((len = bis.read(bytes)) != -1){
			bos.write(bytes, 0, len);
			bos.flush();
		}
		bos.close();
		socket.close();
	}

}
